package cnooc.energy.service.impl;


import cnooc.common.utils.DateUtils;
import cnooc.energy.domain.DeviceDataLocation;
import cnooc.energy.mapper.DeviceDataLocationMapper;
import cnooc.energy.service.IDeviceDataLocationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Set;

/**
 * 设备点位配置Service业务层处理
 * 
 * @author lambda
 * @date 2023-11-28
 */
@Service
public class DeviceDataLocationServiceImpl implements IDeviceDataLocationService
{
    @Autowired
    private DeviceDataLocationMapper deviceDataLocationMapper;

    /**
     * 查询设备点位配置
     * 
     * @param id 设备点位配置主键
     * @return 设备点位配置
     */
    @Override
    public DeviceDataLocation selectDeviceDataLocationById(Long id)
    {
        return deviceDataLocationMapper.selectDeviceDataLocationById(id);
    }

    /**
     * 查询设备点位配置列表
     * 
     * @param deviceDataLocation 设备点位配置
     * @return 设备点位配置
     */
    @Override
    public List<DeviceDataLocation> selectDeviceDataLocationList(DeviceDataLocation deviceDataLocation)
    {
        return deviceDataLocationMapper.selectDeviceDataLocationList(deviceDataLocation);
    }

    @Override
    public List<DeviceDataLocation> selectLocationByDeviceId(Long deviceId, String queryClass) {
        return deviceDataLocationMapper.selectLocationByDeviceId(deviceId,queryClass);
    }

    /**
     * 新增设备点位配置
     * 
     * @param deviceDataLocation 设备点位配置
     * @return 结果
     */
    @Override
    public int insertDeviceDataLocation(DeviceDataLocation deviceDataLocation)
    {
        deviceDataLocation.setCreateTime(DateUtils.getNowDate());
        return deviceDataLocationMapper.insertDeviceDataLocation(deviceDataLocation);
    }

    /**
     * 修改设备点位配置
     * 
     * @param deviceDataLocation 设备点位配置
     * @return 结果
     */
    @Override
    public int updateDeviceDataLocation(DeviceDataLocation deviceDataLocation)
    {
        deviceDataLocation.setUpdateTime(DateUtils.getNowDate());
        return deviceDataLocationMapper.updateDeviceDataLocation(deviceDataLocation);
    }

    /**
     * 批量删除设备点位配置
     * 
     * @param ids 需要删除的设备点位配置主键
     * @return 结果
     */
    @Override
    public int deleteDeviceDataLocationByIds(Long[] ids)
    {
        return deviceDataLocationMapper.deleteDeviceDataLocationByIds(ids);
    }

    /**
     * 删除设备点位配置信息
     * 
     * @param id 设备点位配置主键
     * @return 结果
     */
    @Override
    public int deleteDeviceDataLocationById(Long id)
    {
        return deviceDataLocationMapper.deleteDeviceDataLocationById(id);
    }

    @Override
    public List<DeviceDataLocation> otherLocation(String deviceId, String selfId) {
        return deviceDataLocationMapper.otherLocation(deviceId, selfId);
    }

    @Override
    public Set<String> locationByDeviceId(String deviceId) {
        return deviceDataLocationMapper.locationByDeviceId(deviceId);
    }
}
